package com.overthewall.panel;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.Box;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class InputPanel extends JPanel {

	private static final int MAX_COLUMN_NUM = 10;
	
	private JLabel columnLabel;
	private JComboBox<Integer> columnSelectCombo;
	private JLabel itemsLabel;
	private JComboBox<Integer> itemSelectCombo;
	
	public static int inputColumnNum;
	public static int inputitemNum;
	
	public InputPanel()
	{
		columnLabel = new JLabel("Columns");
		
		columnSelectCombo = new JComboBox<Integer>();
		
		// Initialize ComboBox
		for (int i = 2; i <= MAX_COLUMN_NUM; i++) {
			columnSelectCombo.addItem(i);
		}
		
		columnSelectCombo.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				
				inputColumnNum = (int) columnSelectCombo.getSelectedItem();
//				System.out.println("Selected : "+inputColumnNum);
			}
		});
		
		itemsLabel = new JLabel("Items");
		
		itemSelectCombo = new JComboBox<Integer>();
		
		for (int i = 1; i < MAX_COLUMN_NUM; i++) {
			itemSelectCombo.addItem(i);
		}
		
		itemSelectCombo.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				
				inputitemNum = (int) itemSelectCombo.getSelectedItem();
				
			}
		});
		
		add(columnLabel);
		add(columnSelectCombo);
		
	}
	
}
